package com.app.micaihu.adapter.PagerAdapter;

import android.view.ViewGroup;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.app.micaihu.view.user.userinfo.fragment.AttentionAndFansPageFragment;

import java.util.List;

/**
 * Created by Guo on 2016/12/6.
 * <p>
 * <p>
 * fragmemt 的适配器
 */

public class CommonFragmentAdapter extends FragmentPagerAdapter {

    private List<Fragment> fragments;
    private String[] titles;


    public CommonFragmentAdapter(FragmentManager fm, List<Fragment> fragments, String[] titles) {
        super(fm);
        this.fragments = fragments;
        this.titles = titles;
    }


    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        Object object = super.instantiateItem(container, position);
        return object;
    }


    @Override
    public int getItemPosition(Object object) {
        return POSITION_NONE;
    }


    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }


    @Override
    public int getCount() {
        return fragments.size();
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }


}
